package Day37;

import java.util.Scanner;

/**
 * Creat with IntelliJ IDEA
 * Description
 * User: mamba24
 * Date: 2022-11-07
 * Time: 11:26
 * To BE A Better Person-2020-3-2
 */
public class TestDemo {
    private static int indexoffirstone(int[] arr){
        for (int i = 0; i < arr.length; i++) {
            if(arr[i] == 1){
                return i;
            }
        }
        return -1;
    }
    private static int indexoffirstzero(int[] arr){
        for (int i = 0; i < arr.length; i++) {
            if(arr[i] == 0){
                return i;
            }
        }
        return -1;
    }
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);


        while(sc.hasNext()){
            int num=sc.nextInt();
            int[] time=new int[26];
            int[] time2=new int[26];
            int line=0;
            int index=0;
            while(num > 0){
                char id=sc.next().charAt(0);
                String context= sc.next();
                num--;
                if(context.equals("connect")){
                    //需要连接
                    //检查前面有没有断开的
                    if(indexoffirstzero(time) != -1){
                        //找第一个零
                        int temp_index=indexoffirstzero(time);

                        if(temp_index == index){
                            index++;
                        }
                        time[temp_index]=1;
                        time2[temp_index]++;

                    }else{
                        time[index]=1;
                        time2[index]++;
                        index++;

                    }
                }else{
                    //找到第一个1然后断开连接
                    if(indexoffirstone(time) != -1){
                        time[indexoffirstone(time)]=0;
                        if(indexoffirstone(time) == index-1){
                            index--;
                        }
                    }
                }
            }
            for (int i = 0; i < time2.length; i++) {
                if(time2[i]!=0){
                    line++;
                }
            }
            System.out.println(line);
        }

    }


}
